{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <link rel="stylesheet" href="{% static 'css/bootstrap.css' %}">
    <script src="{% static 'js/jquery-3.2.1.js' %}"></script>
    <script src="{% static 'js/bootstrap.js' %}"></script>

</head>
<body>

    <nav class="navbar navbar-default">
      <div class="container container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                  data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>

          <a class="navbar-brand" href="#">博客园</a>

        </div>

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">

              <ul class="nav navbar-nav">
                    <li class="active"><a href="#">link <span class="sr-only">(current)</span></a></li>

                    <li><a href="#">新闻</a></li>
                    <li><a href="#">小组</a></li>
                    <li><a href="#">收藏</a></li>
                    <li><a href="#">招聘</a></li>
                    <li class="dropdown">
                      <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                         aria-expanded="false">Dropdown <span class="caret"></span></a>
                      <ul class="dropdown-menu">
                        <li><a href="#">Action</a></li>
                        <li><a href="#">Another action</a></li>
                        <li><a href="#">Something else here</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">Separated link</a></li>
                        <li role="separator" class="divider"></li>
                        <li><a href="#">One more separated link</a></li>
                      </ul>
                    </li>
              </ul>

              <ul class="nav navbar-nav navbar-right">
                  {% if request.user.is_authenticated %}
                    <li><a href="/blog/{{ request.user.username }}/">{{ request.user }}</a></li>
                    <li><a href="{% url 'logout' %}">退出登录</a></li>
                  {% else %}
                    <li><a href="{% url 'login' %}">登录</a></li>
                    <li><a href="{% url 'register' %}">注册</a></li>
                    <li><a href="">设置</a></li>
                  {% endif %}
              </ul>

        </div>

      </div>
    </nav>

    <div class="container-fluid">
        <div class="row">

            {# 左侧菜单 #}
            <div class="col-md-2 left_menu">

                <div class="left_menu_top_title">文章分类</div>

                {% for site_c in site_cates %}
                 <ul class="list-group">
                        <li class="left_menu_second_title">{{ site_c.title }}</li>

                        {% for detail in site_c.sitecatedetail_set.all %}
                          <li class="list-group-item hide">
                          {# 文章分类子类 #}
                              <a href="?cate={{ detail }}">{{ detail }}</a>
                          </li>
                         {% endfor %}

                </ul>
                {% endfor %}
            </div>

            {# 内容区 #}
            <div class="col-md-7">
                <div class="article_list">

                    {% for article in all_articles %}

                    <div class="article_item">
                        <h4 class="post_item_title"><a href="/blog/p/{{ article.nid }}/">{{ article.title }}</a></h4>
                        <div class="row post_item_body">

                             <div class="col-md-1">+96
{#                                 <img src="/media/{{ article.blog.user.avatar }}/" width="50px" height="50px">#}
                                 <img src="/media/{{ article.blog.user.avatar }}" width="50px" height="50px">
                             </div>

                            <div class="col-md-11 desc">
                                <p><a href="#">{{ article.desc }}</a></p>
                            </div>

                        </div>
                        <div class="post_item_foot">
                            <a href="/blog/{{ article.blog.site }}/">{{ article.blog.user.username }}</a>&nbsp;&nbsp;
                            <span class="item_create_time">发布于{{ article.create_time|date:"Y-m-d H:i" }}</span>&nbsp;&nbsp;
                            <span class="glyphicon glyphicon-comment" aria-hidden="true">评论({{ article.comment_num }})
                            </span>&nbsp;&nbsp;
                            <span class="glyphicon glyphicon-eye-open">阅读({{ article.read_num }})</span>&nbsp;&nbsp;
                            <span class="glyphicon glyphicon-thumbs-up">点赞({{ article.poll_num }})</span>&nbsp;&nbsp;
                        </div>

                    </div>
                        <hr>
                    {% endfor %}

                </div>

            </div>

            {# 右侧菜单 #}
            <div class="col-md-3">

                <div class="panel panel-primary">
                  <div class="panel-heading">
                    <h3 class="panel-title">Panel title</h3>
                  </div>
                  <div class="panel-body">1111</div>
                </div>

                <div class="panel panel-success">
                  <div class="panel-heading">
                    <h3 class="panel-title">Panel title</h3>
                  </div>
                  <div class="panel-body">2222</div>
                </div>


            </div>
        </div>
    </div>

</body>
<script src="{% static 'js/login.js' %}"></script>
 <link rel="stylesheet" href="{% static 'css/login.css' %}">
</html>